# coding:utf8
import sys

if __name__ == '__main__':
    # 读取第一行
    lines = sys.stdin.readlines()
    date = []
    ms = []
    for line in lines:
        line = line.strip()
        date_line = line.split('.')[0]
        ms_line = line.split('.')[1]
        date.append(date_line)
        ms.append(ms_line)
    # 抢票人数：
    people = len(date)
    # 找出同一秒的日期
    date_similar = [i for i, x in enumerate(date) if x == 1]
    # 同一秒的人数
    second = len(date_similar)
    # 找出一秒内相同的
    ms_similar = [i for i, x in enumerate(ms) if x == 1]
    # 计算票
    count = 0
    # 相同时间内的索引列表
    similar_index = []
    if len(date_similar) > 0:
        # 找出同一秒是否相同的
        if len(ms_similar) > 0:
            for date_sim in date_similar:
                for ms_sim in ms_similar:
                    if date_sim == ms_sim:
                        similar_index.append(ms_similar.index(ms_sim))
                        count += 1
            # 找出同一秒内不同的第一个数
            # 表示同一秒内没有相同的则取这一秒内最小的
            min_ele = ms_similar.index(min(ms_similar))
            for i in similar_index:
                if min_ele not in ms_similar[i]:
                    count = count + 1
    # 不同时间选择最早的
    # 不同时间点的人数
    unsim_date = int(people) - int(second)
    count = count + unsim_date
    print(count)
